home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / stdwin / Ports / x11 / x11.h < prev   
Encoding:
C/C++ Source or Header  |  1993-01-25  |  4.3 KB  |  156 lines  |  [TEXT/????]

  1. /* X11 STDWIN -- private definitions */
  2.  
  3. /* Includes */
  4. #include "tools.h"
  5. #include "stdwin.h"
  6. #include "style.h"        /* For wattr */
  7.  
  8. /* Includes from X11 */
  9. #include <X11/Xlib.h>
  10. #include <X11/Xutil.h>
  11. #include <X11/Xresource.h>
  12. #include <X11/Xatom.h>
  13. #include <X11/cursorfont.h>
  14.  
  15. /* Additional system includes */
  16. #include <sys/time.h>
  17.  
  18. #define IBORDER        1    /* Border width of (most) internal windows */
  19.  
  20. /* Menu item */
  21. struct item {
  22.     char *text;
  23.     char *sctext;
  24.     short shortcut;
  25.     tbool enabled;
  26.     tbool checked;
  27. };
  28.  
  29. /* Menu definition */
  30. struct _menu {
  31.     int id;
  32.     char *title;
  33.     int nitems;
  34.     struct item *itemlist;
  35. }; /* == MENU from <stdwin.h> */
  36.  
  37. /* Window or subwindow essential data */
  38. struct windata {
  39.     Window wid;        /* X Window id */
  40.                 /* The parent is implicit in the use */
  41.     int x, y;        /* Origin w/ respect to parent */
  42.     int width, height;    /* Width and height */
  43.     short border;        /* Border width */
  44.     tbool dirty;        /* Set if update pending */
  45.                 /* Some windows also have an update area */
  46. };
  47.  
  48. #define NSUBS 7            /* Number of subwindows */
  49.  
  50. /* Window struct */
  51. struct _window {
  52.     short tag;        /* Must be first member and must be short! */
  53.     void (*drawproc)();    /* Draw procedure */
  54.     struct {
  55.         int width, height;
  56.     } doc;            /* Document dimension */
  57.     int careth, caretv;    /* Caret position; (-1, -1) if no caret */
  58.     bool caretshown;    /* Is the caret currently on display? */
  59.     long timer;        /* Deciseconds till next alarm */
  60.     TEXTATTR attr;        /* Text attributes */
  61.     
  62.     struct windata subw[NSUBS];    /* Subwindows */
  63.     
  64.     unsigned long fgo, bgo; /* pixel values for all but WA */
  65.     unsigned long fga, bga;    /* pixel values for WA */
  66.     
  67.     GC gc;            /* Graphics Context for all but WA */
  68.     GC gca;            /* Graphics Context for WA */
  69.     
  70.     Region inval;        /* Invalid area in WA window */
  71.  
  72.     int nmenus;        /* Number of menus */
  73.     MENU **menulist;    /* List of attached menus (incl. global) */
  74.     int curmenu;
  75.     int curitem;
  76.     
  77.     tbool resized;        /* True if WE_SIZE event pending */
  78.  
  79.     /* Margins around inner window */
  80.     int lmargin, tmargin, rmargin, bmargin;
  81. }; /* == WINDOW from <stdwin.h> */
  82.  
  83. /* Shorthands for subwindow array access.
  84.    Order is important! --for wopen() */
  85. #define WO    0
  86. #define MBAR    1
  87. #define VBAR    2
  88. #define HBAR    3
  89. #define WI    4
  90. #define WA    5
  91. #define MWIN    6
  92.  
  93. #define wo    subw[WO]    /* Outer window (direct child of root)  */
  94. #define mbar    subw[MBAR]    /* Menu bar (child of wo) */
  95. #define vbar    subw[VBAR]    /* Scroll bars (children of wo) */
  96. #define hbar    subw[HBAR]    /* " */
  97. #define wi    subw[WI]    /* Inner window (child of wo) */
  98. #define wa    subw[WA]    /* Application window (child of wi) */
  99. #define mwin    subw[MWIN]    /* Currently visible menu */
  100.  
  101. /* Button state record */
  102. struct button_state {
  103.     bool down;        /* We think a button is down */
  104.     int button;        /* Which button */
  105.     int mask;        /* Buttons down (1|2|4) */
  106.     int clicks;        /* Click status */
  107.     long time;        /* Time stamp, milliseconds */
  108.     WINDOW *win;        /* The WINDOW where it applies */
  109.     Window w;        /* SubWindow id */
  110.     int isub;        /* Subwindow index */
  111.     int x, y;        /* Current position */
  112.     int xdown, ydown;    /* Position of initial press */
  113. };
  114.  
  115. /* Private globals */
  116. extern Display *_wd;        /* general.c */
  117. extern Screen *_ws;        /* general.c */
  118. extern XFontStruct *_wf;    /* general.c */
  119. extern XFontStruct *_wmf;    /* general.c */
  120. extern int _wpipe[2];        /* general.c */
  121. extern char *_wprogname;    /* general.c */
  122. extern int _wdebuglevel;    /* errors.c */
  123. extern int _wtracelevel;    /* errors.c */
  124. extern COLOR _w_fgcolor;    /* draw.c */
  125. extern COLOR _w_bgcolor;    /* draw.c */
  126.  
  127. /* Interned atoms */
  128. extern Atom _wm_protocols;
  129. extern Atom _wm_delete_window;
  130. extern Atom _wm_take_focus;
  131.  
  132. /* Externals used to communicate hints to wopen() */
  133. extern char *_whostname;
  134. extern char *_wm_command;
  135. extern int _wm_command_len;
  136.  
  137. /* Functions not returning int */
  138. WINDOW *_wsetup();        /* window.c */
  139. WINDOW *_whichwin();        /* window.c */
  140. WINDOW *_wnexttimer();        /* window.c */
  141. GC _wgcreate();            /* window.c */
  142. unsigned long _wgetpixel();    /* window.c */
  143. unsigned long _w_fetchpixel();    /* window.c */
  144. WINDOW *_w_get_last_active();    /* event.c */
  145. WINDOW *_w_somewin();        /* window.c */
  146. Pixmap _w_gray();        /* window.c */
  147. Pixmap _w_raster();        /* window.c */
  148. char *_wgetdefault();        /* general.c */
  149. void _w_setgrayborder();    /* window.c */
  150. void _wsetmasks();        /* window.c */
  151. void _w_initcolors();        /* draw.c */
  152.  
  153. /* Function _wcreate has an extra parameter now */
  154. #define _wcreate(wp, parent, cursor, map, fg, bg) \
  155.     _wcreate1(wp, parent, cursor, map, fg, bg, 0)
  156.